import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yang
 * Date: 2022-09-16
 * Time: 16:57
 */
public class VolatileTest {
    static class Counter{
        public volatile int count = 0;
    }
    public static void main(String[] args) {
        Counter counter = new Counter();
        Thread t1 = new Thread(() -> {
            while(counter.count == 0){

            }
            System.out.println("循环结束");
        });

        t1.start();
        Scanner scanner = new Scanner(System.in);
        counter.count = scanner.nextInt();
    }
}
